﻿using System.Collections.Generic;

namespace Maple.Weixin.MP.Entities.Messages
{
    public class ResponseNews : IResponseService
    {
        private readonly List<Article> articleList = new List<Article>();

        public ResponseNews(string title, string description, string picUrl, string url)
            : this(new Article {Title = title, Description = description, PicUrl = picUrl, Url = url}) {
            
        }

        public ResponseNews(Article article) {
            articleList.Add(article);
        }

        public ResponseNews(IEnumerable<Article> articles) {
            articleList.AddRange(articles);
        }

        #region Implementation of IResponseService

        public ResponseMessageBase Handle(RequestMessageBase requestMessage) {
            var responseMessage = requestMessage.CreateNewsResponse(articleList);
            return responseMessage;
        }

        #endregion
    }
}
